package day6;

import java.util.ArrayList;

//创建四个学生对象到集合中并遍历
public class ArrayListDiyStudent {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<Student>();
        Student one = new Student("富强", 100);
        Student two = new Student("民主", 99);
        Student t = new Student("文明", 98);
        Student fo = new Student("和谐", 97);
        list.add(one);
        list.add(two);
        list.add(t);
        list.add(fo);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).getName() + list.get(i).getAge());
        }
    }
}